﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.components.mainmenu {
    import reprise.ui.*;
    import flash.events.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.constants.*;

    public class FriendsTabDisplay extends AbstractTabView {

        private var m_numberOfFriends:int;// = 0

        public function removeAllFriends():void{
            m_scrollPane.reset();
        }
        public function addFriend(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:String, _arg6:String, _arg7:Boolean, _arg8:Boolean, _arg9:Boolean, _arg10:String):void{
            var _local11:FriendsScrollItem;
            if (this.getFriendById(_arg1)){
                return;
            };
            this.m_numberOfFriends++;
            _local11 = new FriendsScrollItem(_arg1, _arg2, _arg3, _arg4, _arg5, _arg8, _arg9, _arg10);
            _local11.setGroupName(GameConstants.MENU_TAB_FRIENDS);
            _local11.setTooltipData(_arg6);
            if (_arg7){
                _local11.mouseEnabled = false;
                _local11.mouseChildren = false;
                _local11.selected = true;
            } else {
                _local11.addEventListener(MouseEvent.CLICK, this.friendItem_click);
            };
            m_scrollPane.addItem(_local11);
            _local11.index = (m_scrollPane.numberOfItems - 1);
        }
        public function setFriendItemcontrols(_arg1:String):void{
            var _local2:UIComponent;
            var _local3:FriendsScrollItem;
            for each (_local2 in m_scrollPane.items) {
                if (!_local2.mouseEnabled){
                    _local2.addEventListener(MouseEvent.CLICK, this.friendItem_click);
                    _local2.mouseEnabled = true;
                    _local2.mouseChildren = true;
                };
            };
            _local3 = this.getFriendById(_arg1);
            _local3.removeEventListener(MouseEvent.CLICK, this.friendItem_click);
            _local3.mouseEnabled = false;
            _local3.mouseChildren = false;
        }
        public function getFriendById(_arg1:String):FriendsScrollItem{
            var _local2:UIComponent;
            for each (_local2 in m_scrollPane.items) {
                if ((((_local2 is FriendsScrollItem)) && ((FriendsScrollItem(_local2).socialId == _arg1)))){
                    return (FriendsScrollItem(_local2));
                };
            };
            return (null);
        }
        public function addInviteBox(_arg1:String):void{
            var _local2:InviteFriendsScrollItem = new InviteFriendsScrollItem(_arg1);
            _local2.addEventListener(MouseEvent.CLICK, this.friendItem_click);
            m_scrollPane.addItem(_local2);
        }
        public function addInviteBoxes(_arg1:String):void{
            var _local2:uint;
            var _local3:int;
            if (this.m_numberOfFriends < m_scrollPane.numberOfVisibleItems){
                _local2 = (m_scrollPane.numberOfVisibleItems - this.m_numberOfFriends);
                _local3 = 0;
                while (_local3 < _local2) {
                    this.addInviteBox(_arg1);
                    _local3++;
                };
            } else {
                this.addInviteBox(_arg1);
            };
        }
        public function setMeSelected(_arg1:String):void{
            var _local2:FriendsScrollItem = this.getFriendById(_arg1);
            _local2.selected = true;
        }
        public function scrollToId(_arg1:String):void{
            var _local2:FriendsScrollItem = this.getFriendById(_arg1);
            if (_local2){
                m_scrollPane.scrollToIndex(_local2.index);
            };
        }
        public function removeHiddenBird(_arg1:String):void{
            var _local2:FriendsScrollItem = this.getFriendById(_arg1);
            _local2.removeHiddenBird();
        }
        public function removeSymbol(_arg1:String):void{
            var _local2:FriendsScrollItem = this.getFriendById(_arg1);
            if (_local2){
                _local2.removeSymbol();
            };
        }
        private function friendItem_click(_arg1:MouseEvent):void{
            var _local3:UIComponent;
            if ((_arg1.currentTarget is FriendsScrollItem)){
                for each (_local3 in m_scrollPane.items) {
                    if ((_local3 is FriendsScrollItem)){
                        (_local3 as FriendsScrollItem).selected = false;
                    };
                };
                (_arg1.currentTarget as FriendsScrollItem).selected = true;
            };
            var _local2:String = ((_arg1.currentTarget is FriendsScrollItem)) ? FriendsScrollItem(_arg1.currentTarget).socialId : GameConstants.INVITE_FRIEND;
            dispatchEvent(new ViewCompEvent(ViewCompEvent.CLICK, _local2));
        }

    }
}//package net.wooga.pets.views.components.mainmenu 
